# import pwd

# all_users = pwd.getpwall()
# for user in all_users:
#     print(user.pw_name, user.pw_uid, user.pw_gid)

import os
import sys

if sys.platform == 'win32':
    import win32security
    import ntsecuritycon as con
    userx,domain,type = win32security.LookupAccountName("", "Everyone")
    sd = win32security.GetFileSecurity("d:/1.jpg", win32security.DACL_SECURITY_INFORMATION)
    decl=sd.GetSecurityDescriptorDacl()
    decl.AddAccessAllowedAce(win32security.ACL_REVISION, con.FILE_GENERIC_READ|con.FILE_GENERIC_WRITE,userx)
    sd.SetSecurityDescriptorDacl(1, decl, 0)
    win32security.SetFileSecurity("d:/1.jpg", win32security.DACL_SECURITY_INFORMATION, sd)
else:
    os.chmod("/d/1.jpg", 0o777)
    os.chown("/d/1.jpg", 501, -1)